package oop.ex2.filters;

import oop.ex2.filters.exceptions.FilterDataException;

/**
 * Filter of file name checked using wild card.
 */
class FileNameWildCardFilter extends WildCardFilter{
	//********************************************************************
	//  Methods :                                                        *
	//********************************************************************
	/**
	 * Constructs a new wild card filter. 
	 */
	public FileNameWildCardFilter(){
		super();
	}
    /**
     * Returns File's relevant data.
     * @return File's relevant data, or null if the file 
     * doesn't hold the filter condition 
     * (Check directory on non directory file).
     */
    public String[] getFileData(){
    	if (_file.isFile()){
    		return new String[] {_file.getName()};
    	}
    	else{
    		return null;
    	}
    }
    /**
	 * Sets the data of the filter.
	 * @param data The data to be set.
	 * @throws FilterDataException In case of wrong filter parameters. 
	 */
    public void setData( String data ) throws FilterDataException{
        _data = data;
    }
}
